home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / db / esm-3.1 / esm-3 / usr / local / sm / src / client / include / loginfo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-05-05  |  4.0 KB  |  149 lines

  1. #ifndef _LOGINFO_H_
  2. #define _LOGINFO_H_
  3. /*
  4.  *   $RCSfile: loginfo.h,v $  
  5.  *   $Revision: 1.1.1.1 $  
  6.  *   $Date: 1996/05/04 21:55:20 $      
  7.  */ 
  8. /**********************************************************************
  9. * EXODUS Database Toolkit Software
  10. * Copyright (c) 1991 Computer Sciences Department, University of
  11. *                    Wisconsin -- Madison
  12. * All Rights Reserved.
  13. *
  14. * Permission to use, copy, modify and distribute this software and its
  15. * documentation is hereby granted, provided that both the copyright
  16. * notice and this permission notice appear in all copies of the
  17. * software, derivative works or modified versions, and any portions
  18. * thereof, and that both notices appear in supporting documentation.
  19. *
  20. * THE COMPUTER SCIENCES DEPARTMENT OF THE UNIVERSITY OF WISCONSIN --
  21. * MADISON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION.  
  22. * THE DEPARTMENT DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES
  23. * WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
  24. *
  25. * The EXODUS Project Group requests users of this software to return 
  26. * any improvements or extensions that they make to:
  27. *
  28. *   EXODUS Project Group 
  29. *     c/o David J. DeWitt and Michael J. Carey
  30. *   Computer Sciences Department
  31. *   University of Wisconsin -- Madison
  32. *   Madison, WI 53706
  33. *
  34. *     or exodus@cs.wisc.edu
  35. *
  36. * In addition, the EXODUS Project Group requests that users grant the 
  37. * Computer Sciences Department rights to redistribute these changes.
  38. **********************************************************************/
  39.  
  40. #include "lsn.h"
  41.  
  42. typedef struct LogInfo_s LOGINFO;
  43.  
  44. /*
  45.  *    define the structure that holds the state of the open log
  46.  */
  47. struct LogInfo_s {
  48.  
  49.     VOLID       volid;          /* volid that holds the log file    */
  50.     SHORTPID    logFileAddr;    /* page address of first page in log*/
  51.     BUFGROUP     *writeGroup;    /* buffer group for log writes        */
  52.     int            writePages;        /* number of pages in write group    */
  53.     unsigned char    page2size;        /* log 2 of log page size            */
  54.     unsigned short    pageSize;        /* page size of a log page            */
  55.     unsigned int     pageMask;        /* mask of page size                */
  56.     unsigned short    usableBytes;    /* usable bytes on the page            */
  57.     unsigned short    lastUsableByte;    /* last usable byte on the page        */
  58.     SHORTPID     tailPid;        /* pid of current tail of log file    */
  59.     LSNOFFSET     tailLSN;        /* byte offset of current end of log*/
  60.     LSNOFFSET     currentLSN;        /* byte off. of curr. last log record*/
  61.     PAGEHASH     *tailBuffer;    /* pointer to the current end of log*/
  62.     GROUPLINK     *tailLink;        /* link of the tail buffer of the log*/
  63.     int            wrapCount;        /* current wrap count of log        */
  64.     FORCEMARK     logRecordCount; /* monotically increasing log rec count */
  65.     FORCEMARK     forceMark;         /* current force mark of log        */
  66.  
  67.     /* 
  68.      * variable to keep track of the latest tailLSN that we have
  69.      * heard about from the server.  This is our current estimate
  70.      * of the end of the log
  71.      */
  72.     LSN            lastTailLSN;
  73.  
  74.     /*
  75.      * Pointer to lrc to init pages with.  Will point to eiter OneLRC or
  76.      * lastTailLSN depending on value of initLRCisLSN.
  77.      */
  78. #ifdef __cplusplus
  79.     const 
  80. #endif __cplusplus
  81.             LRC *       initLRC;
  82.  
  83.     /*
  84.      * Used to determine how LRCs are initialized on newly allocated
  85.      * pages
  86.      */
  87.     BOOL        initLRCisLSN;
  88.  
  89.     FLAGS        flags;
  90.  
  91.     MAGIC    magic;
  92.     
  93. };
  94.  
  95.  
  96. /*
  97.  *    define the size of the undo buffer
  98.  */
  99. #define LOG_UNDO_BUFFER_SIZE    (1 << 15)
  100.  
  101.  
  102. /*
  103.  *    define the open log magic number
  104.  */
  105. #define LOGINFO_MAGIC    0xd7af5dba
  106.  
  107.  
  108. #if MAGIC_CHECKING IS_ENABLED
  109.  
  110.  
  111. #define INIT_LOGINFO_MAGIC(_logInfo)        \
  112.                             \
  113.     (_logInfo)->magic = LOGINFO_MAGIC;
  114.     
  115.  
  116. #define CHECK_LOGINFO_MAGIC(_logInfo)        \
  117.                             \
  118.     if ((_logInfo)->magic != LOGINFO_MAGIC)    {    \
  119.     SM_ERROR(TYPE_FATAL, esmINTERNAL);        \
  120.     }
  121.  
  122.  
  123. #else
  124.  
  125.  
  126. #define INIT_LOGINFO_MAGIC(_logInfo)
  127.  
  128. #define CHECK_LOGINFO_MAGIC(_logInfo)
  129.  
  130.  
  131. #endif
  132.  
  133.  
  134. /*
  135.  *    define the flags of the open log structure
  136.  */
  137. #define LOG_CLOSE            0x1
  138. #define LOG_CHECKPOINT_IN_PROGRESS    0x2
  139. #define LOG_DIRTYFORCE_IN_PROGRESS    0x4
  140.  
  141.  
  142. /*
  143.  *    define the phases of the log processing
  144.  */
  145. #define ANALYSIS_PHASE    1
  146. #define REDO_PHASE    2
  147.  
  148. #endif _LOGINFO_H_
  149.